/**
 * @properties={typeid:24,uuid:"BFBF6452-ECF4-4073-AEC9-65E6CE9E3127"}
 */
function buscar() {
	controller.loadRecords(gproductoprecio_to_precios_ind)
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"A4E1B42C-EFB2-449D-9DD8-B4AF4BCCA565"}
 */
function agregar(event) {
	if (globals.gProductoPrecio == null)
	{
		globals.DIALOGS.showInfoDialog('Aviso','Elija un producto','OK') //  23/01/2014
		return false
	}
	databaseManager.setAutoSave(false)
	
	var frm 						= forms.precios_proveedor_carga_ind
	frm.controller.newRecord()
	
	frm.producto_id 				= globals.gProductoPrecio
	frm.fecha 						= application.getServerTimeStamp()
	
	frm.elements.proveedor_id.enabled 	= true
	frm.elements.cod_prov.enabled	= true
	frm.elements.fecha.enabled		= true
	frm.elements.precio.enabled		= true
	frm.elements.producto_id.enabled	= false
	frm.elements.bonificacion.enabled	= true
	
	var $win = application.createWindow('CARGA_PRECIO',JSWindow.MODAL_DIALOG)
	frm.controller.show($win)
	return true
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"6DCC6652-0C5C-49C8-A9FF-49ED705109E2"}
 */
function cambiaPrecio(event) {
	databaseManager.setAutoSave(false)
	
	var frm 						= forms.precios_proveedor_carga_ind
	frm.controller.loadRecords(precio_proveedor_id) 
	//frm.producto_id 				= producto_id
	//frm.proveedor_id 				= proveedor_id
	frm.fecha 						= application.getServerTimeStamp()
	
	frm.elements.producto_id.enabled 	= false
	frm.elements.fecha.enabled		= true
	frm.elements.proveedor_id.enabled	= false
	frm.elements.cod_prov.enabled	= false
	frm.elements.precio.enabled		= true
	
	var $win = application.createWindow('CARGA_PRECIO',JSWindow.MODAL_DIALOG)
	$win.title = 'Carga de Precios'
	frm.controller.show($win)
}
